//
//  MyInsureViewController.m
//  EggSteward
//
//  Created by 王道林 on 16/9/8.
//  Copyright © 2016年 王道林. All rights reserved.
//

#import "MyInsureViewController.h"
#import "BaseTableView.h"
#import "DLMacro.h"
#import "SetTableViewCellO.h"
#import "AllPowerViewController.h"
@interface MyInsureViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) BaseTableView *tableView;
@property (nonatomic, strong) NSArray *arrData;
@end

@implementation MyInsureViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _arrData = [NSArray arrayWithObjects:@"我的申请", @"投保历史", nil];
    self.navigationItem.title = @"我的保单";
    // Do any additional setup after loading the view.
    [self createSubview];
}

- (void)createSubview
{
    _tableView = [[BaseTableView alloc] initWithFrame:CGRectMake(0, -50, VIEW_WIDTH, self.view.frame.size.height) style:UITableViewStyleGrouped];
    _tableView.bounces = NO;
    BaseLabel *lable = [[BaseLabel alloc] initWithFrame:CGRectMake(0, 0, VIEW_WIDTH, 50)];
    lable.text = @"我的保单";
    _tableView.tableHeaderView = lable;
    _tableView.delegate = self;
    _tableView.dataSource = self;
    [self.view addSubview:_tableView];
    [_tableView registerClass:[SetTableViewCellO class] forCellReuseIdentifier:@"reuse"];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    SetTableViewCellO *cell = [tableView dequeueReusableCellWithIdentifier:@"reuse" forIndexPath:indexPath];
    cell.labelTitle.text = _arrData[indexPath.row];
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 60;
}


#pragma mark -cell的点击
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    if (indexPath.row == 0) {
        AllPowerViewController *allVC = [[AllPowerViewController alloc] init];
        allVC.navigationTitle = @"我的申请";
        allVC.contectTiltle = @"暂时没有申请信息";
        [self.navigationController pushViewController:allVC animated:YES];
    } else
    {
        AllPowerViewController *allVC = [[AllPowerViewController alloc] init];
        allVC.navigationTitle = @"投保历史";
        allVC.contectTiltle = @"暂无投保历史";
        [self.navigationController pushViewController:allVC animated:YES];
    }
}

- (void)tableView:(UITableView *)tableView didHighlightRowAtIndexPath:(NSIndexPath *)indexPath
{
    SetTableViewCellO *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.backgroundColor = [UIColor colorWithRed:0.886 green:1.000 blue:0.066 alpha:1.000];
}

- (void)tableView:(UITableView *)tableView didUnhighlightRowAtIndexPath:(NSIndexPath *)indexPath
{
    SetTableViewCellO *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.backgroundColor = [UIColor whiteColor];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
